package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeParkToilet;
import com.htgd.gardenexpo.dao.GeParkToiletDao;
import com.htgd.gardenexpo.service.GeParkToiletService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeParkToilet)表服务实现类
 *
 * @author makejava
 * @since 2022-03-19 11:31:44
 */
@Service("geParkToiletService")
public class GeParkToiletServiceImpl implements GeParkToiletService {
    @Resource
    private GeParkToiletDao geParkToiletDao;

    /**
     * 通过ID查询单条数据
     *
     * @return 实例对象
     */
    @Override
    public GeParkToilet queryById(String id) {
        return this.geParkToiletDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeParkToilet> queryAllByLimit(int offset, int limit) {
        return this.geParkToiletDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param geParkToilet 实例对象
     * @return 实例对象
     */
    @Override
    public GeParkToilet insert(GeParkToilet geParkToilet) {
        this.geParkToiletDao.insert(geParkToilet);
        return geParkToilet;
    }

    /**
     * 修改数据
     *
     * @param geParkToilet 实例对象
     * @return 实例对象
     */
    @Override
    public GeParkToilet update(GeParkToilet geParkToilet) {
        this.geParkToiletDao.update(geParkToilet);
        return this.queryById(geParkToilet.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geParkToiletDao.deleteById() > 0;
    }
}
